package cn.xiaolang.function.java_jvm;

/**
 * <p>
   -Xms1024m -Xmx1024m -XX:-UseParallelOldGC -XX:+PrintGC -XX:+PrintGCDetails
   -XX:+PrintGCDateStamps -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/mac/myapp/temp/memory_auto.hprof
 * </p>
 * 或者
 * $ jmap -dump:format=b,file=memory_cmd.hprof 5905<pid>
 *
 * @author fuhw/Dean
 * @date 2019-10-30
 */
public class OomDemo {

    public static void main(String[] args) throws InterruptedException {
        Thread.sleep(20000);
        final int size = 512 * 1024 * 1024;
        byte[] arr1 = new byte[size];
        byte[] arr2 = new byte[size];
        byte[] arr3 = new byte[size];
    }
}
